﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using LiveCS.Common;
using LiveCS.Core;

namespace LiveCS.Forms
{
    public partial class MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        #region 构造函数
        
        public MainForm()
        {
            InitializeComponent();
        }

        #endregion

        #region 事件

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (XtraMessageBox.Show("是否退出系统？", Utilities.MSG_COMPANY,
                MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK)
            {
                this.Dispose();

                Application.Exit();
                Environment.Exit(Environment.ExitCode);
            }
            else
            {
                e.Cancel = true;
            }
        }
        
        private void btnAddMember_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.clientPanel.Controls.Clear();
            this.clientPanel.Controls.Add(GlobalObject.Instance.MemberListForm);
            frmAddMember addMember = new frmAddMember();
            addMember.ShowDialog();
        }

        private void btnMemberList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.clientPanel.Controls.Clear();
            this.clientPanel.Controls.Add(GlobalObject.Instance.MemberListForm);
        }

        private void btnWaitList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.clientPanel.Controls.Clear();
            this.clientPanel.Controls.Add(GlobalObject.Instance.WaitListForm);
        }

        private void btnFightList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.clientPanel.Controls.Clear();
            this.clientPanel.Controls.Add(GlobalObject.Instance.FightListForm);
        }

        private void btnExitList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.clientPanel.Controls.Clear();
            this.clientPanel.Controls.Add(GlobalObject.Instance.ExitListForm);
        }

        private void btnAboutUs_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            XtraMessageBox.Show("关于我们", Utilities.MSG_COMPANY,
                MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void btnExit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Close();
        }

        #endregion
    }
}
